package com.relax.shiwu;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class ServiceShiwuImpl implements ServiceShiwu{

    @Autowired
    private StudentMapper studentMapper;


    @Transactional()
    @Override
    public void out() {
        studentMapper.update(1,"Outer" + System.currentTimeMillis());
//        inner();
        int i = 1 / 0;

    }

//    @Transactional(propagation = Propagation.REQUIRES_NEW)
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void inner() {
        studentMapper.update(2,"Inner" + System.currentTimeMillis());
    }
}
